#!/bin/bash
#
#  Copyright (C) 2013-2014 RuneAudio Team
#  http://www.runeaudio.com
#
#  RuneUI
#  copyright (C) 2013-2014 - Andrea Coiutti (aka ACX) & Simone De Gregori (aka Orion)
#
#  RuneOS
#  copyright (C) 2013-2014 - Simone De Gregori (aka Orion) & Carmelo San Giovanni (aka Um3ggh1U)
#
#  RuneAudio website and logo
#  copyright (C) 2013-2014 - ACX webdesign (Andrea Coiutti)
#
#  This Program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 3, or (at your option)
#  any later version.
#
#  This Program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with RuneAudio; see the file COPYING.  If not, see
#  <http://www.gnu.org/licenses/gpl-3.0.txt>.
#
#  file: command/sndusb_nrpacks
#  version: 1.3
#  coder: Simone De Gregori
#
#####################################
sndusb_profile() {
    local "${@}"
    mpc pause > /dev/null 2>&1
    sleep 0.3
    modprobe -r snd-usb-audio
    echo "options snd-usb-audio nrpacks=${nrpacks}" > /etc/modprobe.d/modprobe.conf
    sleep 0.2
    modprobe snd-usb-audio
    sleep 0.5
}
if [ $1 -ge 1 ]; then
    echo "set snd-usb-audio nrpacks="$1
    sndusb_profile nrpacks=$1
    exit 0
fi
if [ "$1" == "" ]; then
    echo "set snd-usb-audio nrpacks {value}"
    echo "Usage: $0 {value}"
    exit 1
fi
